/**
 * 
 */
package com.busfm.service;

import android.accounts.AbstractAccountAuthenticator;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorResponse;
import android.accounts.NetworkErrorException;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;

/**
 * @author DJ
 * 
 */
public class AccountsService extends Service {

	private AccountAuthenticator accountAuthor;

	public IBinder onBind(Intent intent) {
		IBinder ret = null;
		if (intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT))
			ret = getAuthenticator().getIBinder();
		return ret;
	}

	private AccountAuthenticator getAuthenticator() {
		if (accountAuthor == null)
			accountAuthor = new AccountAuthenticator(this);
		return accountAuthor;
	}

	private class AccountAuthenticator extends AbstractAccountAuthenticator {
		public AccountAuthenticator(Context context) {
			super(context);
		}

		// @Override
		public Bundle confirmCredentials(AccountAuthenticatorResponse arg0, Account arg1, Bundle arg2)
				throws NetworkErrorException {
			// TODO Auto-generated method stub
			return null;
		}

		// @Override
		public Bundle editProperties(AccountAuthenticatorResponse arg0, String arg1) {
			// TODO Auto-generated method stub
			return null;
		}

		// @Override
		public Bundle getAuthToken(AccountAuthenticatorResponse arg0, Account arg1, String arg2, Bundle arg3)
				throws NetworkErrorException {
			// TODO Auto-generated method stub
			return null;
		}

		// @Override
		public String getAuthTokenLabel(String arg0) {
			// TODO Auto-generated method stub
			return null;
		}

		// @Override
		public Bundle hasFeatures(AccountAuthenticatorResponse arg0, Account arg1, String[] arg2)
				throws NetworkErrorException {
			// TODO Auto-generated method stub
			return null;
		}

		// @Override
		public Bundle updateCredentials(AccountAuthenticatorResponse arg0, Account arg1, String arg2, Bundle arg3)
				throws NetworkErrorException {
			// TODO Auto-generated method stub
			return null;
		}

        @Override
        public Bundle addAccount(AccountAuthenticatorResponse arg0, String arg1, String arg2, String[] arg3, Bundle arg4)
                throws NetworkErrorException {
            // TODO Auto-generated method stub
            return null;
        }
	}
}
